package by.dkusch.aircompany.model.tables;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import by.dkusch.aircompany.model.tables.base.BaseEntity;

@Entity
public class Flight extends BaseEntity<Long> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@NotNull
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Crew.class)
	private Crew crew;

	@Column
	private Date startTime;

	@Column
	private Date endTime;
	
	@NotNull
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Route.class)
	private Route route;

	@NotNull
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Plane.class)
	private Plane plane;

	@Min(0)
	@Max(Integer.MAX_VALUE)
	@Column
	private Integer passClass1;

	@Min(0)
	@Max(Integer.MAX_VALUE)
	@Column
	private Integer passClass2;

	@Min(0)
	@Max(Integer.MAX_VALUE)
	@Column
	private Integer passClass3;

	@Size(max = 250)
	@Column
	private String description;

	public Crew getCrew() {
		return crew;
	}

	public void setCrew(Crew crew) {
		this.crew = crew;
	}

	public Date getStartTime() {
		return startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Route getRoute() {
		return route;
	}

	public void setRoute(Route route) {
		this.route = route;
	}

	public Plane getPlane() {
		return plane;
	}

	public void setPlane(Plane plane) {
		this.plane = plane;
	}

	public Integer getPassClass1() {
		return passClass1;
	}

	public void setPassClass1(Integer passClass1) {
		this.passClass1 = passClass1;
	}

	public Integer getPassClass2() {
		return passClass2;
	}

	public void setPassClass2(Integer passClass2) {
		this.passClass2 = passClass2;
	}

	public Integer getPassClass3() {
		return passClass3;
	}

	public void setPassClass3(Integer passClass3) {
		this.passClass3 = passClass3;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

}
